﻿@{
    ViewBag.Title = "DieuTraMastter";
    Layout = "~/Views/Shared/_LayoutBusiness.cshtml";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<link href="~/Content/index.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
<script>

    function getview(p_logincode, p_fullname) {

        var url = "@Html.Raw(Url.Action("GetThongTinChung", "Online", new { logincode = "-p_logincode" }))";
        //var url2 = "@Html.Raw(Url.Action("GetThongTinChung", "Online")) ";
        url = url.replace("-p_logincode", p_logincode);
        $("#partial").load(url)
        $("#FullNameTemp").text(p_fullname);
        $("#tempLogincode").text(p_logincode);
        $("#tempStep").text(1);
    }
    function GetViewNext(p_isnext) {
        //var p_step = "1";
        var p_logincode = $("#tempLogincode").text();
        var p_step = $("#tempStep").text();

        if (Number(p_isnext) == Number(1)) {
            p_step = Number(p_step) + Number(1);
        } else {
            if (p_step > 1) {
                p_step = Number(p_step) - Number(1);
            }
        }
        //alert(p_step);
        $("#tempStep").text(p_step);
        //is next =1
        var actionName = "GetThongTinChung";
        //alert(p_logincode);
        var url = "@Html.Raw(Url.Action("GetThongTinChung", "Online", new { logincode = "-p_logincode" }))";
        if (p_step == 1) {
            url = "@Html.Raw(Url.Action("GetThongTinChung", "Online", new { logincode = "-p_logincode" }))";
        }else if(p_step==2)
        {
            url = "@Html.Raw(Url.Action("GetThongTinCaNhan", "Online", new { logincode = "-p_logincode" }))";
        }
       
        url = url.replace("-p_logincode", p_logincode);
        //alert(url);
        $("#partial").load(url)
    }


</script>
@using (Html.BeginForm())
{
    if (ViewData["data"] != null)
    {
        DHQGHN.PM2.Models.Online.DieuTraMastterViewModel dieutra = ViewData["data"] as DHQGHN.PM2.Models.Online.DieuTraMastterViewModel;
        @Html.Hidden("tempLogincode")
        @Html.Hidden("tempStep")
        <div class="container">

            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th class="col-lg-3">
                            Các thành viên trong hộ
                        </th>
                        <th class="col-lg-9">
                            Câu hỏi dành cho <span class="text-danger" id="FullNameTemp">@dieutra.SelectedResdent.First().Value.ToString()</span>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="col-lg-3">

                            @if (dieutra.Resdent != null && dieutra.Resdent.Count > 0)
                            {
                                foreach (var item in dieutra.Resdent)
                                {

                                    <div class="row text-danger">
                                        @*@Html.ActionLink(item.Value.ToString(), "")*@
                                        <button type="button" class="btn-link" onclick="getview('@item.Key','@item.Value')">@item.Value</button>

                                    </div>

                                }
                            }

                        </td>
                        <td class="col-lg-9">
                            <div class="row">
                                <div id="partial" class="col-lg-12">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-12">
                                    <button type="button" class="btn btn-default btn-sm" onclick="GetViewNext(0)">Quay lại</button>
                                    <button type="button" class="btn btn-sm btn-default" onclick="GetViewNext(1)">Tiếp theo</button>
                                </div>

                            </div>

                        </td>

                    </tr>
                </tbody>
            </table>

        </div>
    }
}

